<template>
  <div class="home-page">
    <div class="welcome-section">
      <h1>欢迎使用 Todo Manager</h1>
      <p>高效管理您的任务，提升工作效率</p>
      <div class="actions">
        <el-button type="primary" size="large" @click="goToTodo">
          开始管理任务
        </el-button>
        <el-button size="large" @click="goToLogin" v-if="!isLoggedIn">
          立即登录
        </el-button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { computed } from 'vue';
import { useRouter } from 'vue-router';
import { useUserStore } from '@/store/userStore';

const router = useRouter();
const userStore = useUserStore();

const isLoggedIn = computed(() => userStore.isLoggedIn);

const goToTodo = () => {
  router.push('/todo');
};

const goToLogin = () => {
  router.push('/login');
};
</script>

<style scoped>
.home-page {
  padding: 40px;
  text-align: center;
}

.welcome-section {
  max-width: 600px;
  margin: 0 auto;
}

.welcome-section h1 {
  font-size: 48px;
  color: #303133;
  margin-bottom: 20px;
}

.welcome-section p {
  font-size: 18px;
  color: #606266;
  margin-bottom: 40px;
}

.actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}
</style>
